/*************************************************************************
	> File Name: ./include/ThreadCache.h
	> Author: zq
	> Mail: zhouquan1511@163.com 
	> Created Time: Thu 27 Apr 2023 12:05:31 PM CST
 ************************************************************************/
#pragma once
#include "Common.h"

class ThreadCache {
private:
	FreeList _freeLists[NFREELISTS]; //哈希桶
public:
	void* Allocate(size_t size); //申请对象
	void Deallocate(void *ptr, size_t size); //释放对象
	void* FetchFromCentralCache(size_t index,
								size_t alignSize);//从central cache获取内存
	void ListTooLong(FreeList &list, size_t size); //回收内存到中心缓存
};

//TLS - thread local storage
static _declspec(thread) ThreadCache *pTLSThreadCache = nullptr;

